package com.bosssoft.hr.jobmonitor.util;

import lombok.Data;

/***
 * @Author lys(cherish)
 * @Description 前端响应对象
 * @Date  2019/2/26
 **/
@Data
public class ResponseUtil {
    //    响应码
    private Integer code;
    //    响应描述
    private String desc;
    //    响应信息携带数据
    private Object data;

    public ResponseUtil(Integer code, String desc, Object data) {
        this.code = code;
        this.desc = desc;
        this.data = data;
    }

    public ResponseUtil(){

    }
    /***
     * @Author lys(cherish)
     * @Description 响应自定义简单信息
     * @Date  2019/2/26
     * @Param [code, desc, data]
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil info(Integer code, String desc, Object data){
        return new ResponseUtil(code,desc,data);
    }

    /***
     * @Author lys(cherish)
     * @Description 响应成功信息，携带数据
     * @Date  2019/2/26
     * @Param [data]
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil successful(Object data){
        return  new ResponseUtil(200,"成功",data);
    }

    /***
     * @Author lys(cherish)
     * @Description 响应成功信息，不携带数据
     * @Date  2019/2/26
     * @Param []
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil successful(){
        return  new ResponseUtil(200,"成功",null);
    }

    /***
     * @Author lys(cherish)
     * @Description 响应失败信息，不携带数据
     * @Date  2019/2/26
     * @Param []
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil fail(){
        return new ResponseUtil(400,"失败",null);
    }

    /***
     * @Author lys(cherish)
     * @Description 响应参数错误信息，不携带数据
     * @Date  2019/2/26
     * @Param []
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil badParam(){
        return new ResponseUtil(400,"错误参数",null);
    }

    /***
     * @Author lys(cherish)
     * @Description 响应错误鉴权信息，不携带数据
     * @Date  2019/2/26
     * @Param []
     * @return com.bosssoft.hr.jobmonitor.util.ResponseUtil
     **/
    public static ResponseUtil badAuthConfig(){
        return new ResponseUtil(400,"错误账户配置",null);
    }

}
